package cn.tedu_01;

import com.sun.prism.shader.Solid_TextureYV12_AlphaTest_Loader;
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

public class StringBulidTest {
    public static void main(String[] args) {
        // method();
        //method2();
       // method3();
        //method4();
      //  method5();
       // method6();
      //  method7();
        method8();

    }

    private static void method8() {



    }

    private static void method7() {
        String s = "abcdefghijk";
        StringBuffer sb =new StringBuffer();
        long start = System.currentTimeMillis();
        for(int i = 0;i<100000;i++ ){
            sb.append(s);
        }
        long end = System.currentTimeMillis();
        System.out.println(end-start);
    }

    private static void method6() {
        String s = "abcdefghijk";
        StringBuilder sb = new  StringBuilder();
        long start = System.currentTimeMillis();
        for(int i = 0;i<100000;i++){
            sb.append(s);
        }
        long end = System.currentTimeMillis();
        System.out.println(end-start);

    }

    private static void method5() {
        String s = "abcdefghijk";
        String res = "";
        long start = System.currentTimeMillis();
        for(int i = 0;i<100000;i++){
          res = res+s;
        }
        long end = System.currentTimeMillis();
        System.out.println(end-start);


    }

    private static void method4() {
        String s= "abcdefghijklmn";
        StringBuilder sb=new StringBuilder();
        long start = System.currentTimeMillis();
        for(int i = 0;i<100000;i++){
            sb.append(s);
        }
        long end = System.currentTimeMillis();
        System.out.println(end-start);


    }

    private static void method3() {
        String s= "abcdefghijklmn";
        String res = "";
        long start = System.currentTimeMillis();
        for(int i = 0 ;i<100000;i++){
            res = res + s;
        }

        long end = System.currentTimeMillis();
        System.out.println(end-start);
    }

    private static void method2() {
        String s = "abcdefghi" ;
        StringBuilder sb =new StringBuilder();
        long start = System.currentTimeMillis();
        for(int i = 0;i<100000;i++){
            sb.append(s);
        }
        long end=System.currentTimeMillis();
        System.out.println(end-start);




    }

    private static void method() {
        String s = "abcdefghi";
        String result = "";
        long start = System.currentTimeMillis();
        for(int i = 0;i<100000;i++){
            result = result + s;
        }
        long end = System.currentTimeMillis();
        System.out.println(end-start);
    }
}
